package com.softserveinc.model;

import com.softserveinc.R;

public enum Certification {

	RATE_R("R", R.drawable.icon_r),

	RATE_PG_13("PG_13", R.drawable.icon_pg_13),

	RATE_PG("PG", R.drawable.icon_pg),

	RATE_G("G", R.drawable.icon_g);

	private final String certificationName;
	private final int icon;

	private Certification(final String certificationName, final int icon) {
		this.certificationName = certificationName;
		this.icon = icon;
	}

	public static Certification getCertificationForName(final String value) {

		if (value == null) {
			return RATE_PG_13;
		}

		for (Certification c : Certification.values()) {
			if (c.certificationName.equalsIgnoreCase(value)) {
				return c;
			}
		}

		return RATE_PG_13;
	}

	public Integer getValidIconID() {
		return icon;
	}

	@Override
	public String toString() {
		return certificationName;
	}
}
